package de.gwtprime.server.model;

import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import de.gwtprime.shared.VoteType;



@Entity
@Table(name = "question_vote")
public class QuestionVote extends EntityBase {
	
	/**
	 * SerialVersionUID
	 */
	private static final long serialVersionUID = 1L;
	
	private VoteType type = VoteType.UP;
	private Question question;
	
	public VoteType getType() {
		return type;
	}

	public void setType(VoteType type) {
		this.type = type;
	}

	@ManyToOne
	@JoinColumn
	public Question getQuestion() {
		return question;
	}

	public void setQuestion(Question section) {
		this.question = section;
	}
	
	public void remove(){
		//long id = getQuestion().getId();
		super.remove();
		//HibernateHelper.find(Question.class, id).decreaseVoteValueAndPersist();
	}

}
